﻿// Copyright © Microsoft Corporation.  All Rights Reserved.
// This code released under the terms of the 
// Microsoft Public License (MS-PL, http://opensource.org/licenses/ms-pl.html.)

using System.Windows.Controls;
using System.Windows.Media;

namespace TheOliver.Phone.Tools.Controls
{
    public partial class CompassControl : UserControl
    {
        public CompassControl()
        {
            InitializeComponent();

            _rotate = new RotateTransform();
            
            _rotateArea.RenderTransform = _rotate;

            this.Loaded += (s, e) =>
            {
                _rotate.CenterX = this.ActualWidth / 2.0;
                _rotate.CenterY = this.ActualHeight / 2.0;

            };
        }


        RotateTransform _rotate;

        public double Heading 
        {
            get
            {
                return _rotate.Angle;
            }
            set
            {
                _rotate.Angle = value;
            }
        }
    }
}
